package cn.platform.controller;

import cn.platform.response.AResponse;
import cn.platform.service.HarmonyParentService;
import cn.platform.service.HarmonyTeacherService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(maxAge = 3600) //允许跨域请求
@Controller
@RequestMapping("/api/harmony-parent")
public class HarmonyParentController {
    @Resource
    HarmonyParentService harmonyParentService;

    /**
     * 根据家长id查询家长信息
     *
     * @param id 家长id
     * @return AResponse res 家长的信息
     *
     * @author jyz
     */
    @GetMapping("/get-role/{id}")
    @ResponseBody
    public AResponse getRoleMessage(@PathVariable Integer id){
        return harmonyParentService.getRoleMessage(id);
    }

    /**
     * 根据家长id查询其绑定的小孩
     *
     * @param id 家长id
     * @return AResponse res 家长的信息
     *
     * @author jyz
     */
    @GetMapping("/get-role-message/{id}")
    @ResponseBody
    public AResponse getParentClass(@PathVariable Integer id){
        return harmonyParentService.getParentChildren(id);
    }
}
